<?php

class Item {
	public $scan_code;
	public $product_code;
	public $designer_code;
	public $type;
	public $year;
	public $season;
	public $flow;
	public $material;
	public $color;
	public $size;
	public $designer;
	public $name;
	public $price;
	public $ratio;
	public $active;
	
	
	public function __construct($scan_code,$product_code,$designer_code,$type,$year,$season,$flow,$material,$color,$size,$designer,$name,$price,$ratio,$active)  
    {


        if(!isset($product_code)){
        	$this->loadFromScan_code($scan_code);
        }else{
    	$this->scan_code=$scan_code;
	    $this->product_code=$product_code;
    	$this->designer_code=$designer_code;
    	$this->type=$type;
    	$this->year=$year;
    	$this->season=$season;
    	$this->flow=$flow;
    	$this->material=$material;
    	$this->color=$color;
    	$this->size=$size;
	    $this->designer=$designer;
		$this->name=$name;
		$this->price=$price;
		$this->ratio=$ratio;
		$this->active=$active;
		}
	
	}
	
	public function loadFromScan_code($scan_code)  
    {
      
         
    	$this->scan_code=$scan_code;
	    $this->product_code=substr($scan_code, 0,10);
    	$this->designer_code='O'.substr($scan_code, 0,2).substr($scan_code, 6,3);
    	$this->type=substr($scan_code, 0,2);
    	$this->year=substr($scan_code, 2,3);
    	$this->season=substr($scan_code, 5,1);
    	$this->flow=substr($scan_code, 6,3);
    	$this->material=substr($scan_code, 9,1);
    	$this->color=substr($scan_code, 10,2);
    	$this->size=substr($scan_code, 12,2);
	    $this->designer="O";
		$this->name="";
	
	}
}

?>